67642ac0915444ee13b3d27af38ebf178dc3b55e,lucee-java/lucee-core/src/lucee/runtime/type/scope/session/SessionCache.java,SessionCache,getInstance,#String#String#PageContext#Log#Session#,77

Before Change



	public static Session getInstance(String cacheName, String appName, PageContext pc,Log log, Session defaultValue) {
		try {
			return getInstance(cacheName, appName, pc,log);
		}
		catch (PageException e) {}
		return defaultValue;

After Change


	 * @return client datasource scope
	 * @throws PageException
	 */
	public synchronized static Session getInstance(String cacheName, String appName, PageContext pc, Session existing, Log log) throws PageException {
		CacheEntry ce = _loadData(pc, cacheName, appName,"session", log);
		if(ce!=null) {
			print.e("has data:");
			if(existing instanceof StorageScopeCache) {
				print.e("has pair:"+(((StorageScopeCache)existing).lastModified())+":"+(ce.lastModified().getTime()));
				if(((StorageScopeCache)existing).lastModified()>=ce.lastModified().getTime()) {
					print.e("use existing:");
					return existing;
				}
			}
			return new SessionCache(pc,cacheName,appName,(Struct)ce.getValue(),ce.lastModified().getTime());
		}
		else if(existing!=null) {
			print.e("return existing");
			return  existing;
		}

		print.e("new");
		
		SessionCache session = new SessionCache(pc,cacheName,appName,new StructImpl(),0);
		session.store(pc.getConfig());
		return session;
	}